package com.sgb.kjwl.view.ui.adapter.pick;

import android.content.Context;
import android.graphics.Typeface;
import android.view.View;
import com.sgb.kjwl.BR;
import com.sgb.kjwl.R;
import com.sgb.kjwl.databinding.ItemPickCategoryLeftBinding;
import com.swgk.core.util.PickSelectEntity;
import com.swgk.core.recyclerview.adapter.BaseRecycleAdapter;
import com.swgk.core.recyclerview.adapter.ItemViewHolder;
import java.util.List;

public class PickCategoryLeftAdapter extends BaseRecycleAdapter<PickSelectEntity> {

    public PickCategoryLeftAdapter(Context context, List<PickSelectEntity> datas) {
        super(context, R.layout.item_pick_category_left, datas);
    }

    @Override
    public void convert(ItemViewHolder holder, PickSelectEntity entity) {
        holder.setBinding(BR.viewModel, entity);
        boolean selected = holder.itemView.isSelected();
        ((ItemPickCategoryLeftBinding) holder.getmBinding()).categoryMark.setVisibility(selected ? View.VISIBLE : View.INVISIBLE);
        if (selected) {
            ((ItemPickCategoryLeftBinding) holder.getmBinding()).tvName.setTypeface(null, Typeface.BOLD);
        } else {
            ((ItemPickCategoryLeftBinding) holder.getmBinding()).tvName.setTypeface(null, Typeface.NORMAL);
        }
    }

}
